package work5;

/**
 * @TODO
 * @Author xu
 * 2025/2/26
 */
public class Work1 {public static void main(String[] args) {
    int[] arr = {10, 20, 30, 40, 50, 60};
    int index = findMaxIndex(arr);
    System.out.println("最大元素值的索引值是: " + index);
}

    public static int findMaxIndex(int[] arr) {
        int maxIndex = 0;
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > arr[maxIndex]) {
                maxIndex = i;
            }
        }
        return maxIndex;
    }

}
